<html><head>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
<meta name="wap-font-scale" content="no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<title>新芽阅读个人中心</title>
<link rel="shortcut icon" href="javascript:void(0)http://img2.2345.com/bookimg/public/pic/book/book_icon.png">
<link rel="stylesheet" href="/static/css/mobile-global.css">
	<link rel="stylesheet" href="/static/css/mobile-user.css">
 {css href="/static/layout/css/style-responsive.css" }
  {css href="/static/css/toastr.min.css"}
<style>
	.sl-custom-file {
        position: relative;
        display: inline-block;
        zoom: 1;
        cursor: pointer;
        overflow: hidden;
        vertical-align: middle;
        top:0px;
        left:20px;
    }
   .btn-file{
            background: url('/static/images/details/icon.png') 0px 6px no-repeat !important;
            color: #666 !important;
            border: none !important;
            width: 136px !important;
            height:46px !important;
            border-radius: 5px !important;
            text-align:center !important;
            line-height:47px !important;
     }  

   .sl-custom-file .ui-input-file {
        position: absolute;
        right: 0;
        top: 0;
        _zoom: 30;
        font-size: 300px \9;
        height: 100%;
        _height: auto;
        opacity: 0;
        filter: alpha(opacity=0);
        -ms-filter: "alpha(opacity=0)";
        cursor: pointer;
     }
     .pass-portrait-msg{color: #999;display: inline-block;margin-left: 6px;text-align:left;position: relative;top:10px;left:8px;}
     .pass-portrain-commonp{margin:0;padding: 0 0 18px 0;color:#666;font-size:12px;}
     .icon{border:none;}
     #cmt-form{background-color:white;height:100px;}
</style>
</head>
<body id="xtopjsinfo" ontouchstart="">
<!--wrapper begin-->
<div class="wrapper userCenter">
<!-- header begin -->
<header class="header inner-header">
<h1 class="sub-title">用户中心</h1>
<a href="{:url('mobile/index/index')}" class="home iconfont icon-home" onclick="cc('ck_m_fanhuishouye')"></a></header>
<!--header end--><div class="container">
<!-- user -->
<div class="uc-info">
	<div class="avatar"><img src="{$data.icon}" width="60px" height="60px"></div>
	<p class="name">{$data.name}</p>
	<p class="balance">账号：<b class="spec">{$data.tel}</b></p>
<a class="btn-primary" btn-size="small" href="{:url('mobile/Personal/icon',['id'=>$Request.session.user.id])}">更换头像</a></div>
<ul class="uc-op-list">
		<li><a href="{:url('mobile/Personal/index')}">返回上一级</a></li>
</ul>
<form method="post" enctype="multipart/form-data" id="cmt-form">
   <input type="hidden" name="id" value="{$data.id}"><br>
   <span class="sl-custom-file">
       <input type="button" value="选择图片" class="btn-file"/>
       <input type="file" id="usericon" class="ui-input-file" name="icon" data-id="{$data.id}"/>
   </span>
   <span class="pass-portrait-msg">支持jpg、jpeg、gif、png、bmp格式的图片</span>

</form>
<button class="btn btn-default icon" style="margin-top:10px;">保存头像</button>
<ul class="uc-op-list" style="margin-top:20px;">
		<li><a href="{:url('mobile/Personal/logout')}">退出登录</a></li>
</ul>
</div>
</div>
<!--wrapper end-->
<!--footer begin-->
<!--footer begin-->
<footer class="footer">
<p class="links"><a href="{:url('mobile/index/index')}">小说首页</a><i>|</i><a href="javascript:void(0)/app/Personal.html">手机客户端</a><i>|</i><a href="javascript:void(0)/m/Personal.php/c/feedback/">问题反馈</a><i>|</i><a href="javascript:void(0)#xtopjsinfo" class="go_top">返回顶部</a></p>
</footer>
{js href="/static/layout/js/jquery-1.10.2.min.js" }
{js href="/static/js/toastr.min.js"}
<script>
  $(function(){

       toastr.options = {
            closeButton: true,// 是否显示关闭按钮
            progressBar: true,// 实现显示计时条
            timeOut: "3000",  // 自动关闭时间
            positionClass: "toast-top-right" // 提示位置
            // toast-top-full-width 顶端，宽度铺满整个屏幕
            // toast-top-right  顶端右边
        };
      $('.icon').click(function () {
         var formData = new FormData();
         var id = $(".ui-input-file").attr('data-id');
         formData.append("file",$(".ui-input-file")[0].files[0]);
         formData.append("id",id);
         $('#cmt-form').submit(CommentIcon(formData));
      });



  });
	
  function CommentIcon(data) {
          $.ajax({
              data:data,
              type: 'post',
              url: '/changeicon/',
              processData : false, 
              // 告诉jQuery不要去设置Content-Type请求头
              contentType : false,
              success: function (data) {
                  if (data.status) {
                      toastr.success(data.info);
                      window.location.reload();
                  } else {
                      toastr.error('请选择你的图片', 'FBI WARING:');
                  }
              },
              error: function () {
                  toastr.error('请选择你的图片', 'FBI WARING:');
              }
          });
      }
</script>
</body></html>